#火车购票车次页面控件

from common.commontools import decorator
from selenium.webdriver.common.by import By
from common.basedriver import BaseDriver

class TrainBuyPage(BaseDriver):

    #日期标签
    @decorator()
    def the_two_date(self):
        return self.find_element(By.CSS_SELECTOR,".trainList_box ul.cal_middle>li:nth-child(2)")

    #左箭头
    @decorator()
    def left_arrow(self):
        return self.find_element(By.CSS_SELECTOR,".cal_left")

    #右箭头
    @decorator()
    def right_arrow(self):
        return self.find_element(By.CSS_SELECTOR,".cal_right")

    #选择普通车标签
    @decorator()
    def ordinary_seat(self):
        return self.find_element(By.CSS_SELECTOR,"#search_cate_vue>dl:nth-child(1)>dd:nth-child(5) i")

    #选择硬座标签
    @decorator()
    def hard_seat(self):
        return self.find_element(By.CSS_SELECTOR,"#search_cate_vue>dl:nth-child(2)>dd:nth-child(9) i")

    #选择0点~6点的出发时间段
    @decorator()
    def zero_to_six_date(self):
        return self.find_element(By.CSS_SELECTOR,"#search_cate_vue>dl:nth-child(3)>dd:nth-child(3) i")

    #选择往返
    @decorator()
    def return_box(self):
        return self.find_element(By.CSS_SELECTOR,"#selTicketType>[value='1']")

    #出发城市
    @decorator()
    def depart_city(self):
        return self.find_element(By.CSS_SELECTOR,"#departCityPy")

    #到达城市
    @decorator()
    def arrive_city(self):
        return self.find_element(By.CSS_SELECTOR,"#arriveCityName")

    #出发日期
    @decorator()
    def depart_date(self):
        #要先去掉readonly属性
        return self.find_element(By.CSS_SELECTOR,"#departDate")



